<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-if和v-show区别</title>
    <script src="/js/vue.js"></script>
</head>
<body>
<div id="hcp">
    <p>v-if如果条件不成立元素不显示，v-show如果条件不成立元素也不显示</p>
    <p>v-if直接删除元素，所以不显示</p>
    <p>v-show设置了display=none样式，所以不显示</p>
    <p v-if="rich">有钱花</p>
    <p v-show="rich">有钱花</p>

    <button @click="rich=!rich">彩票开奖</button>
    <hr>
    <h3>{{ hh() }}</h3>
</div>

<script>
    new Vue({
        el: "#hcp",
        data: {
            rich:true
        },
        methods: {
            hh: function () {
                return "hello";
            }
        }
    });
</script>
</body>
</html>